<template>
  <div class="risk">
    <eagle-page-list
      ref="eaglePageList"
      @bindData="bindData"
      :queryParams="queryParams"
      :controller="controller"
      :conditions="conditions"
      :pageSize="20"
    >
      <template #list>
        <eagle-cell
          style="margin-top: 10px"
          class="br-8"
          v-for="(item, index) in list"
          :key="index"
        >
          <eagle-tag
            v-if="item.Status == 10 && !item.IsExpire"
            class="info_tag"
            color="#1989fa"
            >进行中</eagle-tag
          >
          <eagle-tag v-if="item.Status == 20" class="info_tag" type="warning"
            >已结束</eagle-tag
          >
          <eagle-tag
            v-if="item.Status == 10 && item.IsExpire"
            class="info_tag"
            type="danger"
            >已过期</eagle-tag
          >
          <div class="warn_item">
            <div @click="goDetail(item)">
              <eagle-row>
                <van-col span="24">
                  {{ index + 1 }}、{{ item.CheckTaskName }}</van-col
                >
              </eagle-row>
              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="12">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_type.png"
                    alt=""
                  />{{ item.CheckTypeName }}</eagle-col
                >
                <eagle-col span="12">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_danger.png"
                    alt=""
                  />隐患/检查：{{ item.HiddenDangerCnt }}/{{
                    item.CheckCnt
                  }}</eagle-col
                >
              </eagle-row>

              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="12">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_user.png"
                    alt=""
                  />{{ item.CreateChnName }}</eagle-col
                >
              </eagle-row>

              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="24">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_date.png"
                    alt=""
                  />{{ item.StartDate }}至{{ item.EndDate }}</eagle-col
                >
              </eagle-row>
            </div>
          </div>
        </eagle-cell>
      </template>
    </eagle-page-list>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      conditions: {},
      controller: "/DangerCheckTask",
      queryParams: {
          dataType: "DangerCheckAreaPlanTask",
          checkAreaType: "Equipment",
          checkAreaCode: this.$route.query.checkAreaCode,
      },
    };
  },
  created() {
  },
  methods: {
	bindData(data) {
      this.list = [];
      if (data) {
          this.list = data;
      }
    },
    goDetail(item) {
      this.$router.push({
        path: "/Danger/DangerCheckTaskEdit",
        query: { id: item.ID },
      });
    },
    getFile(equipmentCode) {
      this.$router.push({
        path: "/Equipment/safetyfile",
        query: { equipmentCode: equipmentCode },
      });
    },
    // 编辑设备信息
    edit(equipmentCode) {
      this.$router.push({
        path: "/Equipment/Edit",
        query: { equipmentCode: equipmentCode },
      });
      this.$router.push("");
    },
    // 设备检验
    editCheck(equipmentCode) {
      this.$router.push({
        path: "/Equipment/editcheck",
        query: { equipmentCode: equipmentCode },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.all_dep {
  background-color: #ffffff;
}
.van-cell {
  padding: 0px 0px;
  .info_tag {
    position: absolute;
    border-top-right-radius: 3px;
    border-bottom-left-radius: 3px;
    top: 0;
    right: 0;
  }
}
.warn_item {
  margin: 10px;
  padding: 10px 0;
  // background-color: #ffffff;
  /*margin-bottom: 10px;*/
  // padding: 10px 0 10px 10px;
  border-radius: 5px;
  position: relative;
}
.warn_header {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 10px;
  .warn_tag {
    position: absolute;
    right: 0;
    top: 0;
    border-radius: 26.64rem 0 0 26.64rem;
  }
}
.dep_sort {
  // display: flex;
  // flex-wrap: wrap;
  // margin-bottom: 5px;
  img {
    height: 15px;
    width: 15px;
    margin-right: 5px;
  }
}
.dep_btm {
  display: flex;
  justify-content: flex-end;
  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}
</style>
